package top.suven.base.http.config;


import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName:
 * @Description:
 * @Author lixiangling
 * @Date 2018/7/13 16:10
 * @Copyright: (c) 2018 gc by https://www.gc.com.cn/
 * @Version : 1.0.0
 * --------------------------------------------------------
 * modifyer    modifyTime                 comment
 * <p>
 * --------------------------------------------------------
 */
public enum LoginValidType {
    SESSION,TOKEN,ALL;

    private static Map<String, LoginValidType> typeMap = new HashMap<>();
    static {

        for (LoginValidType type : values()) {
            typeMap.put(type.name(), type);
        }
    }

    public static LoginValidType getLoginValidType(String name) {
        return typeMap.get(name);
    }

    public static boolean equalsName(String validType){
        return typeMap.keySet().contains(validType);
    }
    public static boolean isToken(String validType){
       if(ALL.name().equalsIgnoreCase(validType)){
           return true;
       }
        return TOKEN.name().equalsIgnoreCase(validType);
    }
    public static boolean isSession(String validType){
        if(ALL.name().equalsIgnoreCase(validType)){
            return true;
        }
        return SESSION.name().equalsIgnoreCase(validType);
    }
}
